<?php
/**
 * Created by PhpStorm.
 * User: phc
 * Date: 19-8-15
 * Time: 下午2:25
 */

namespace app\common\model;


class AboutModel extends CommonModel
{

    protected $jobTable = "zbc_job";

    public function getJobs()
    {
        $result = db($this->jobTable)
            ->where('enable', '=', 1)
            ->order(['createtime' => 'asc'])
            ->select();

        return $result;
    }

    public function getJobsPage($size = 10, $page = 1)
    {
        $result = db($this->jobTable)
            ->where('enable', '=', 1)
            ->order(['createtime' => 'asc'])
            ->limit($size * ($page - 1), $size)
            ->select();

        return $result;
    }

    public function getJobsCount($size = 10, $page = 1)
    {
        return $this->getCount($this->jobTable);
    }

    public function deleteJobs($arrayId)
    {
        return $this->deleteByIds($this->jobTable, $arrayId);
    }

    public function addJob($param)
    {
        return $this->add($this->jobTable, $param);
    }

    public function getJobById($id)
    {
        return $this->getById($this->jobTable, $id);
    }

    public function updateJobById($param)
    {
        return $this->updateById($this->jobTable,$param);
    }
}